<?php
    require_once(APPPATH . '/controllers/test/Toast.php');

    class Gallery_tests extends Toast
    {
        var $id = 23;

        function __construct()
        {
            parent::__construct(__FILE__);
            $this->load->helper('folder');
            $this->load->config('gallery');
            if(file_exists(APPPATH."libraries/gallery.php")){
                $this->load->library("gallery");
            }
            if(file_exists(APPPATH."libraries/object_gallery_lib.php")){
                $this->load->library("object_gallery_lib");
            }
        }

        /*Insert new gallery in DB*/
        public function test_insert_to_db()
        {
            // insert into gallery
            $insert_id = $this->gallery->add($this->id);
            // insert into gallery_objects
            $insert_id = $this->object_gallery_lib->add($this->id,$insert_id);
        }

        /*Create new gallery folder  */
        public function test_create_main_direcoty()
        {
            // create gallery folder for new object
            if(!$this->gallery->create_main_direcoty($this->id)) 
                $this->_fail('create gallery folder for new object fail:)');
        }

        /*Create all thumbnails directories defined in gallery config */
        public function test_create_thumbnails_directories()
        {
            // create thumbnails directories from gallery config
            $this->gallery->create_thumbnails_directories($this->id);

        }
    }

?>
